package com.rbcs.base.company.webapp;

import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.rbcs.base.company.CompanyHelp;
import com.rbcs.base.company.service.CompanyManager;
import com.rbcs.base.model.Company;
import com.systop.core.webapp.struts2.action.DefaultCrudAction;

@SuppressWarnings("serial")
@Controller
@Scope(BeanDefinition.SCOPE_PROTOTYPE)
public class CompanyAction extends DefaultCrudAction<Company, CompanyManager> {

	public String edit() {
		Company com = getManager().findObject("from Company");
		if (com != null) {
			setModel(com);
		}
		return INPUT;
	}

	public String save() {
		getManager().save(getModel());
		CompanyHelp.COMPAY = getModel();
		addActionMessage("单位信息保存成功");
		return INPUT;
	}

}
